<?php
/**
* ABSoft Banner Item
* @version 1.0
* @since Apr 2, 2011
* 
* Change logs
* Aug 23, 2011 - trungdt - Add desc property, to compatible with Thanhoc Online Project
*/
class abhtml5 {
    /**
    * Generate edit form
    * 
    * @param mixed $object
    * @param mixed $config
    * @param mixed $type Shown type, =0 for Text, =2 for Flash, =1 for Image
    * @return form
    */
    function form($object, $config, $type) {
        if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
        exponent_forms_initialize();
        
        $form = new form();
        if (!isset($object->id)) {

            $object->rank=0;
            $object->name="";
            //
            $object->backimg="";
            //
            $object->cssfrom=0;
            $object->cssto=0.6;
            //
            $object->for_desktop="";
            $object->thumb=-1;
            //
            $object->desc="";
            $object->for_ie8="";
        } else {
            $form->meta('id',$object->id);
        }
        
        
        $form->register('name','Name',new textcontrol($object->name));
        $form->register('backimg','Background image',new textcontrol($object->backimg));
        $form->register('backcss','Background css',new textcontrol($object->backcss));
;
        $form->register('cssfrom','Opacity from',new textcontrol($object->cssfrom));
        $form->register('cssto','Opacity to',new textcontrol($object->cssto));
        
        //Review 
        $template = new template('abhtml5module','review',$loc);
        $template->assign('jsondata',$object->json_data);
        $template->assign('config',$config);
        $html= $template->render();
                
        $form->register('json','Content',new htmlcontrol($html));
        //
        $form->register('for_desktop','Content',new  texteditorcontrol($object->for_desktop));
        
        $form->register('',null,new htmlcontrol("Easing: easeInOutSine, easeInOutQuart, easeInOutQuad, easeInOutBack,"));
        $review='<br><a class="button" href="#div_review" id="div_review_a">Review</a><br><br>';
        $form->register('','',new htmlcontrol($review));
        $form->register('thumb','Select Thumbnail', new ajax_select_file('thumb',0,$object->thumb,true));
        $form->register('desc','Description',new textcontrol($object->desc));
                
        $form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
        return $form;
    }

    function update($values,$object) {
        $object->name = $values['name'];
        $object->desc = $values['desc'];
        $object->backimg = $values['backimg'];
        $object->backcss = $values['backcss'];
        $object->thumb = $values['thumb'];
        $object->cssfrom = $values['cssfrom'];
        $object->cssto = $values['cssto'];
        //$object->for_mobile = $values['for_mobile'];
        $object->for_desktop = $values['for_desktop'];
        $object->json_data = $values['json_data'];
        
        return $object;
    }
}

?>